<?php
/**
 * OntoWiki Client New-Plugins Template
 *
 * @author Feng Qiu <Qiu_Feng39@hotmail.com>
 * @version $Id: new-plugins.phtml 3224 2009-06-07 14:33:00Z qiu_feng39@hotmail.com $
 */
?>

	


<?php $new_plugins = $this->escape($this->new_plugins);?>
<?php $plugins_per_page = $this->escape($this->plugins_per_page);?>
<?php 
	$newplugins_in_days = $this->escape($this->newplugins_in_days);
	$sort_kind = $this->sort_kind;
	$sort_priority = $this->sort_priority;
?>
<?php $this->placeholder('categories.box.content')->captureStart() ?>
<form method="post" action="<?php echo $new_plugins;?>">
	<fieldset>
	<div class="no-min-width">
		<span id="select-container-lat-prop-select" class="width99">
			<select name="newplugins_in_days" class="width99" id="id_newplugins_in_days">
			    <option value="0" <?php if ($newplugins_in_days == 0) echo 'selected';?>>Today</option>
				<option value="3" <?php if ($newplugins_in_days == 3) echo 'selected';?>>In 3 Days</option>
				<option value="7" <?php if ($newplugins_in_days == 7) echo 'selected';?>>This Week </option>
				<option value="30" <?php if ($newplugins_in_days == 30) echo 'selected';?>>In 30 Days</option>
				<option value="90" <?php if ($newplugins_in_days == 90) echo 'selected';?>>In 90 Days</option>
			</select>
		</span>
	</div>
	<div class="no-min-width">
		<span id="select-container-lat-prop-select" class="width99">
			<select name="sort_kind" class="width99" id="id_sort_kind">
			    <option value="name" <?php if ($sort_kind == 'name') echo 'selected';?>>Name</option>
				<option value="developer" <?php if ($sort_kind == 'developer') echo 'selected';?>>Developer</option>
			</select>
		</span>
	</div>
	<div class="no-min-width">
		<span id="select-container-lat-prop-select" class="width99">
			<select name="sort_priority" class="width99" id="id_sort_priority">
				<option value="ASC" <?php if ($sort_priority == 'ASC') echo 'selected';?>>Anodically</option>
				<option value="DESC" <?php if ($sort_priority == 'DESC') echo 'selected';?>>Descending</option>
			</select>
		</span>
		<span id="select-container-lat-prop-select" class="width99">
			<select name="plugins_per_page" class="width99" id="id_sort_priority">
			    <option value="1" <?php if ($plugins_per_page == 1) echo 'selected';?>>1 plugin per page</option>
			    <option value="2" <?php if ($plugins_per_page == 2) echo 'selected';?>>2 plugins per page</option>
			    <option value="3" <?php if ($plugins_per_page == 3) echo 'selected';?>>3 plugins per page</option>
			    <option value="5" <?php if ($plugins_per_page == 5) echo 'selected';?>>5 plugins per page</option>
			    <option value="10" <?php if ($plugins_per_page == 10) echo 'selected';?>>10 plugins per page</option>
			    <option value="20" <?php if ($plugins_per_page == 20) echo 'selected';?>>20 plugins per page</option>
			</select>
		</span>
	</div>
	</fieldset>
	<div><button type="submit" name="submit"><?php echo $this->_('Submit') ?></button></div>
</form>
<?php $this->placeholder('categories.box.content')->captureEnd() ?>

<?php $this->placeholder('main.window.innerwindows')->append(
	$this->partial('partials/window.phtml', array(
		'headinglevel' => 2, 
		'title'        => $this->_('New Plugins:'), 
		'content'      => $this->placeholder('categories.box.content'), 
		'cssClasses'   => '', 
		'cssId'        => ''
	))
);?>

<?php $tag_results = $this->tags;?>
<?php $this->placeholder('categories.tagcloud.content')->captureStart() ?>
	<div class="tagcloud_window">
		<?php
			for($i=0; $i<count($tag_results);$i++){
				$tag= $tag_results[$i]['tag'];
				$weight = $tag_results[$i]['weight'];
				$tag_url = $tag_results[$i]['url'];
				echo "<div class=\"tag_style_$weight\"><a href=\"$tag_url\">$tag</a></div>";
			}
		?>
	</div>	
<?php $this->placeholder('categories.tagcloud.content')->captureEnd() ?>

<?php $this->placeholder('main.window.innerwindows')->append(
	$this->partial('partials/window.phtml', array(
		'headinglevel' => 3, 
		'title'        => $this->_('Tags'), 
		'content'      => $this->placeholder('categories.tagcloud.content'), 
		'cssClasses'   => '', 
		'cssId'        => ''
	))
);?>

<?php $results = $this->results;?>
<?php if (count($this->paginator)):?>
<?php
	$pic_url = $this->pluginurl."templates/plugins/pic/";
	$logo = $pic_url."plugin_logo.gif";
	$plugin_outlook = $this->plugin_outlook;
	if (isset($this->deadline)) {
		$deadline = $this->deadline;
	}
	$theme = $pic_url."categorie_theme.png";	
	if (isset($results)) {
		$i = 1;	// to create id for each plugin
		foreach ($this->paginator as $result) {
				$pName = $result['name'];
				$developer = $result['developer'];
				$description = $result['description'];
				$install_url = $result['install_url'];
				$s_plugin_id = "plugin_".$i."_s";		//selected plugin_id
				$u_plugin_id = "plugin_".$i;		// unselected plugin_id
				$i++;
				if ($plugin_outlook == 1) {
					echo<<<showResults
					<div class="qiufeng_template">
						  <div class="plugin_selected" id="$s_plugin_id" >
								<div class="left_window">
									<img src="$theme" alt="categorie" width="50" height="50"/>		
								</div>
							<div class="right_window">
								<div class="title_window">
									<p class="plugin_title">$pName</p>
								</div>
								<div class="logo_window">
									<img src="$logo" alt="logo_window" width="80" />			
								</div>
								<div class="description_window">
									$description			
								</div>		
								<div class="install_window">
								  <div class="author">$developer</div>
								  	<form method="post" action="$this->toinstall_url">
									 	<input type="hidden" name="install_url" value="$install_url"></input>
										<input type="hidden" name="t_p_categorie" value="components"></input>
										<input type="hidden" name="t_p_name" value="$pName"></input>
								  		<button type="submit" value="Install" class="install">Install</button>
								  	</form>
								</div>
							</div>       
						  </div>
						  
						
						  <div class="plugin_unselected" id="$u_plugin_id" onclick="select_plugin('$u_plugin_id')">
								<div class="left_window">
									<img src="$logo" alt="categorie" width="50" height="38" border="1px" />		</div>
							<div class="right_window">
								<div class="title_window">
									<p class="plugin_title">$pName</p>
								</div>
								<div class="description_window">
									$description		
								</div>...		
								
							</div>      
						  </div>
					</div>
				
showResults;
				}
				
				elseif ($plugin_outlook == 2) {
					echo<<<showResults
					<div class="plugins">
					  	<div class="plugin_box">
					  		<div class="titel">
								$pName
							</div>
					  	</div>
					  
					  	<div class="plugin_box">
					  		<div class="author">
								<span class="black">Author:</span>  $developer
							</div> 
					  	</div>
					  	
					  	<div class="plugin_box">
					  		<div class="description">
								$description
							</div>
					 	</div>
					  
					  	<div class="plugin_box">
					  		<form method="post" action="$this->toinstall_url">
							 	<input type="hidden" name="install_url" value="$install_url"></input>
								<input type="hidden" name="t_p_categorie" value="components"></input>
								<input type="hidden" name="t_p_name" value="$pName"></input>
								<button type="submit" value="Install" class="install_button">Install</button>
							</form>
					  	</div>
					</div>
showResults;
				}
					
		}
	}
	if (isset($deadline)) {
		$deadline = substr($deadline, 0, 10);
		echo "<br/><font color=\"red\">The plugins since $deadline</font><br/>";
	}
	?>
	<?= $this->paginationControl($this->paginator, 'Elastic', '/pagelist/categoriepagelist.phtml'); ?>
<?php endif; ?>

